package OtherSwing;

public class insertionSort {
	public static int[] InsertionMethod(String insertion)  {
		String delimeter =" ";
		String[] parts = insertion.split(delimeter);
		int[] array =  new int[parts.length];
		for(int i=0; i<parts.length; i++){
			array[i] = Integer.parseInt(parts[i]);
		}
	       int length = array.length;
	      int x = 0;
	       int j = 0;
	       for(int i=1;i<length;i++){
	       x = array[i];
	       j = i;
	       while(j>0 && array[j-1]>x)
	       {
	       array[j] = array[j-1];
	       j = j-1;
	       array[j] = x;
	       } 
	       }
	       
	      
		return array;
	       
	       
	    }
}
